Skip to main content

TsgDWGImage

Unit: DWG

Description

The main TsgDWGImage class is a descendant of TsgCADImage (which is a descendant of TGraphic) and overrides its methods. TsgDWGImage can be used in the TImage control for displaying and navigation AutoCAD™ DWG drawings.

Learn more about DWG

DWG is a widely used file format for exchanging 2D and 3D CAD data. It's not an open format but owned by AutoDesk Inc. who used it for their program AutoCAD™. With every new version of AutoCAD the definition of DWG is changed but nevertheless there are many of programs which are capable of reading and writing some form of DWG. After loading a DWG file, its separate DWG/DXF entities are accessible through the Converter property and its indexed properties Blocks and Entities. All entities are descendants of TsgDXFEntity. For example, the TEXT entity has TsgDXFText type, etc. In other words, the entities are common for both DXF and DWG.

Syntax

TsgDWGImage = class(TsgCADImage)

Properties

PropertiesDescription
PreviewThe property contains the bitmap for the DWG image preview.
Properties derived from TsgCADImageDescription
BackgroundColorThe property specifies the background color of the drawing which TsgCADImage displays.
BlocksThe property lists the blocks references of the drawing.
BorderSizeThe property specifies the size of the drawing’s border in global points or ratio.
BorderTypeThe property sets the type of drawing’s border.
CachingRasterModeThe property specifies the size of drawing’s border in global points or ratio.
CBFormatThe property displays predefined clipboard format.
ColorToLineWeightThe property specifies the line weight for entities by colors.
ConverterThe property contains information about the loaded CAD file.
CurrentLayoutThe property sets the current layout.
DefaultColorThe property sets the color for elements which have white color in AutoCAD™ DXF/DWG
DimensionsVisibleThe property switches on or off dimension of the drawing.
DrawingBoxThe property defines drawing box.
DrawMatrixThe property gets the matrix used for drawing.
DrawModeThe property specifies the current color mode.
EntitiesThe property lists all the entities of the CAD file.
ExtentsThe property defines drawing's extents.
FileNameThe property gets and sets the name of the file from which the image is loaded.
IsDraw3DAxesThe property gets and sets 3Daxes drawing mode.
IsDrawingRotatedThe property defines if the drawing is rotated.
IsLoadingThe property defines if the drawing is loading.
IsPlottingThe property defines the destination source status.
IsProcessMessagesThe property defines the messages processing mode.
IsShowBackgroundThe property can be used to show background.
IsShowLineWeightThe property can be used to draw all entities with NullWidth pixel lineweights.
IsWithoutBorderThe property can be used to draw the drawing without adding the empty space (borders).
LayoutsThe property gets the indexed layout.
LayoutsCountThe property gets the number of layouts.
LineWeightScaleThe property gets and sets the line weight scale.
MillimetersThe property can be used to change the drawing units (millimeters/inches)
NullWidthThe property specifies the default line weight of entities with zero lineweight.
OwnSourceThe property indicates if data is loaded.
PureExtentsThe property defines the exact image field in world coordinates, with no empty space added.
ResizeDisproportionateDrawingThe property points to layer, containing given primitive if this layer is given.
ScaleThe property returns scale factor of the image as TFPoint structure.
ShowImagesThe property gets and sets the raster image drawing mode.
StretchThe property indicates whether the CAD drawing should be changed so that it exactly fits the bounds of the image control.
TextVisibleThe property switches on or off texts of the CAD image.
TTFModeThe property specifies the mode of the TTF fonts reflection.
UseWinEllipseThe property can be used for drawing most of the arcs and circles in the image using GDI Windows functions such as Ellipse, Arc, etc., not linearized.
ViewRectangleFor CAD Import VCL internal uses only.

Methods

MethodsDescription
AssignThe method copies a CAD image object and increase reference to the Converter object.
LoadFromStreamThe method loads a CAD image from stream.
LoadPreviewFromFileThe method loads the preview.
SaveToStreamThe method saves the image to the stream.
Methods derived from TsgCADImageDescription
AbsHeightThe method returns the entire height of the CAD image.
AbsWidthThe method returns the entire width of the CAD image.
AddScaledDXFThe method adds a new drawing to the TsgCADImage object.
AddScaledDXFExThe method adds a new drawing to the TsgCADImage object.
CommonToInternalUnitsThe method converts CAD coordinates of an image to the coordinates of the inner drawing's coordinate system.
CreateCreates and initializes a new TsgCADImage object.
DestroyDestroys an instance of the TsgCADImage class.
DrawRectThe method renders a part of a loaded drawing on a device context specified by DC.
ExportToMetafileThe method exports a CAD drawing to a Windows Enhanced metafile
GetCADCoordsThe method returns coordinates of a point on a drawing.
GetEntityColorThe method returns the entity's color.
GetExtentsThe method recalculates the drawing extents.
GetObjectSnapMaskThe method returns the object snap mode.
GetPointThe method converts point from the 3D coordinate system to the 2D coordinate system.
GetPointUCSThe method converts the UCS coordinates to the screen coordinates.
GetRealImagePointThe method the real coordinates of the point.
GetSnapDataThe method returns the data structure that contains the closest entity to the argument point, and the node point.
GetVisibleAreaThe method returns the visible area.
InternalToCommonUnitsThe method converts the coordinates of the inner drawing's coordinate system to the CAD coordinates of an image.
LoadFromClipboardFormatThe method loads from clipboard.
LoadFromFileThe method loads a CAD image from file.
MeasurementThe method returns the information about measurement system for linear and angular measures.
RefreshCurrentLayoutThe method refreshes sizes of the current layout.
ResetDrawingBoxThe method switches off the drawing box.
RotateThe method rotates the current image.
RotDefaultThe method rotates the image to the default view.
RotToViewThe method rotates the image by parameter defined in A3DView.
SaveToClipboardFormatThe method saves to clipboard.
SaveToFileThe method saves the image to the file.
SetObjectSnapMaskThe method sets the object snap mode.
SetVisibleAreaThe method sets an area for snap.
StopLoadingThe method stops loading the file and displays only the loaded data.

Events

Events derived from TsgCADImageDescription
OnAfterRotateThe event occurs after a CAD image being rotated.
OnBeforeRotateThe event occurs before a CAD image being rotated.
OnLayoutChangeThe event occurs when a current layout is being changed.

Types

TypesDescription
TdwgVersion

Variables and constants

Variables and constantsDescription
CF_DWGPredefined clipboard format for use in the LoadFromClipboardFormat method.